<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
		<title>宝宝信息</title>
		<script type="text/javascript" src="js/init.js"></script>
		<link rel="stylesheet" type="text/css" href="css/common.css">
		<link rel="stylesheet" type="text/css" href="css/login.css">
		<link rel="stylesheet" type="text/css" href="css/sm.css" />
	</head>

	<body>
		<div class="login">
			<div class="login-logo">
				<img src="images/logo-title.png" />
			</div>
			<div class="login-form">
				<div class="input-row">
					<img src="images/name-icon.png" class="fl input-icon" />
					<span class="fl line"></span>
					<input class="fl input-content j-name" type="text" placeholder="请输入您的姓名" />
					<div class="clear"></div>
				</div>
				<div class="input-row">
					<img src="images/phone-icon.png" class="fl input-icon" />
					<span class="fl line"></span>
					<input class="fl input-content j-phone" type="text" placeholder="请输入您的手机号码" />
					<div class="clear"></div>
				</div>
				<div class="input-row two-row fl">
					<img src="images/code-icon.png" class="fl input-icon" />
					<span class="fl line"></span>
					<input class="fl input-content j-vcode" type="text" placeholder="请输入短信验证码" />
					<div class="clear"></div>
				</div>
				<div class="input-row very-code fl j-getCode">
					<span>获取验证码</span>
				</div>
				<div class="next-btn j-submit">
					<button>下一步</button>
				</div>
			</div>
		</div>
		<script src="js/zepto.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="js/sui/sm.js"></script>
		<script type="text/javascript">
			$(function() {
				$('.j-submit').click(function() {
					var name = $('.j-name').val();
					var phone = $('.j-phone').val();
					if($.trim(name).length == 0) {
						$.toast("名字不能为空");
					} else if($.trim(phone).length == 0) {
						$.toast("手机号码不能为空");
					} else if(!/(^1[3|4|5|7|8]\d{9}$)/.test(phone)) {
						$.toast("请输入正确的手机号码");
					}
					
				})
				$('.j-getCode').click(function() {
					var phone = $('.j-phone').val();
					if($.trim(phone).length == 0) {
						$.toast("手机号码不能为空");
					} else if(!/(^1[3|4|5|7|8]\d{9}$)/.test(phone)) {
						$.toast("请输入正确的手机号码");
					} else if($(this).hasClass('disabled')){
						$.toast("请稍等");
					}else{
						$(this).addClass('disabled');
						var val=$('.j-getCode span')[0];
						settime(val);
					}
					
				})
			})
			var countdown = 2;

			function settime(val) {
				if(countdown == 0) {	
					$('.j-getCode').removeClass('disabled');
					val.innerHTML = "重新获取";
					countdown = 2;
				} else {
					val.innerHTML = "重新发送(" + countdown + "s)";
					countdown--;
					setTimeout(function() {
					settime(val)
				}, 1000)
				}
				
			}
			
		</script>
	</body>

</html>